package com.example.minefieldkeepercloud.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import com.example.minefieldkeepercloud.R;
import com.example.minefieldkeepercloud.bean.MachineDetailBean;
import com.example.minefieldkeepercloud.util.TimeUtil;
import com.king.base.adapter.ViewHolderAdapter;
import com.king.base.adapter.holder.ViewHolder;

import java.text.ParseException;
import java.util.List;

public class MachineDetaiAdapter extends ViewHolderAdapter<MachineDetailBean.DataBean> {
    private Context context;

    public MachineDetaiAdapter(Context context, List<MachineDetailBean.DataBean> listData) {
        super(context, listData);
        this.context = context;
    }

    @Override
    public View buildConvertView(LayoutInflater layoutInflater, MachineDetailBean.DataBean string, int position) {
        return inflate(R.layout.adapter_machinedetail);
    }

    @Override
    public void bindViewDatas(ViewHolder holder, MachineDetailBean.DataBean bean, final int position) {
        holder.setText(R.id.tv_HandleUserName, bean.getHandleUserName());
        holder.setText(R.id.tv_tjlx, bean.getTjlx());
        try {
            holder.setText(R.id.tv_UpdateTime, TimeUtil.dealDateFormatNomm2(bean.getUpdateTime()+""));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        try {
            holder.setText(R.id.tv_CreatedTime, TimeUtil.dealDateFormatNomm2(bean.getCreatedTime()+""));
        } catch (ParseException e) {
            e.printStackTrace();
        }

        holder.setText(R.id.tv_IP, bean.getIP());
        holder.setText(R.id.tv_ModelName, bean.getModelName());
        holder.setText(R.id.tv_RealtimeSuanLi, bean.getRealtimeSuanLi()+"");
        holder.setText(R.id.tv_averageSuanLi, bean.getAverageSuanLi()+"");
        holder.setText(R.id.tv_ActualPower, bean.getActualPower()+"");
        holder.setText(R.id.tv_FanSpeed, bean.getFanSpeed()+"");
        holder.setText(R.id.tv_CustomerName, bean.getCustomerName());
        holder.setText(R.id.tv_MonRunTime, bean.getMonRunTime());

    }
}
